#ifndef _SOCKET_H
#define _SOCKET_H

#include <header.h>



class Socket
{
public:
    inline
    Socket() {
        _fd = socket(AF_INET,SOCK_STREAM,0);
        if(_fd<0){
            perror("Socket::socket");
        }
    }
    Socket(int fd):_fd(fd){}

    ~Socket() {
        if(_fd>0){
          close(_fd);
          _fd = -1;
        }
    };
    int fd()const{return _fd;}

    void shutdownPtr(){
        shutdown(_fd,SHUT_WR);
    }

private:
    int _fd;
};
#endif

